package com.probiz.estore.common.model.product.base;

import com.probiz.estore.common.model.product.ProductType;
import com.probiz.estore.common.model.product.SkuOptionValue;
import com.probiz.estore.core.model.BaseObject;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import java.io.Serializable;

/**
 * SkuOptionSearch Base Java Bean, base class for the model, mapped directly to database table
 * <p/>
 * Avoid changing this file if not necessary, will be overwritten.
 */
public class SkuOptionSearchTbl extends BaseObject implements Serializable {

    protected Integer skuOptionSearchId;
    protected Integer skuOptionId;
    protected Integer sortOrder;
    protected SkuOptionValue skuOptionValue;
    protected ProductType productType;


    /**
     * Default Empty Constructor for class SkuOptionSearch
     */
    public SkuOptionSearchTbl() {
        super();
    }

    /**
     * Default Key Fields Constructor for class SkuOptionSearch
     *  @param  in_skuOptionSearchId id
     */
    public SkuOptionSearchTbl(Integer in_skuOptionSearchId) {
        this.setSkuOptionSearchId(in_skuOptionSearchId);
    }


    public SkuOptionValue getSkuOptionValue() {
        return skuOptionValue;
    }

    public void setSkuOptionValue(SkuOptionValue skuOptionValue) {
        this.skuOptionValue = skuOptionValue;
    }

    public ProductType getProductType() {
        return productType;
    }

    public void setProductType(ProductType productType) {
        this.productType = productType;
    }

    /**
     * * @return Integer
     *
     * @hibernate.id column="skuOptionSearchId" type="java.lang.Integer" generator-class="native"
     */
    public Integer getSkuOptionSearchId() {
        return this.skuOptionSearchId;
    }

    /**
     * Set the skuOptionSearchId
     */
    public void setSkuOptionSearchId(Integer aValue) {
        this.skuOptionSearchId = aValue;
    }

    /**
     * 商品类型id	 * @return Integer
     */
    public Integer getProductTypeId() {
        return this.getProductType() == null ? null : this.getProductType().getProductTypeId();
    }

    /**
     * Set the productTypeId
     */
    public void setProductTypeId(Integer aValue) {
        if (aValue == null) {
            productType = null;
        } else {
            productType = new ProductType(aValue);
            productType.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
        }
    }

    /**
     * 规格属性id	 * @return Integer
     */
    public Integer getSkuOptionValueId() {
        return this.getSkuOptionValue() == null ? null : this.getSkuOptionValue().getSkuOptionValueId();
    }

    /**
     * Set the skuOptionValueId
     */
    public void setSkuOptionValueId(Integer aValue) {
        if (aValue == null) {
            skuOptionValue = null;
        } else {
            skuOptionValue = new SkuOptionValue(aValue);
            skuOptionValue.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
        }
    }

    /**
     * 规格id	 * @return Integer
     *
     * @hibernate.property column="skuOptionId" type="java.lang.Integer" length="10" not-null="true" unique="false"
     */
    public Integer getSkuOptionId() {
        return this.skuOptionId;
    }

    /**
     * Set the skuOptionId
     *
     * @spring.validator type="required"
     */
    public void setSkuOptionId(Integer aValue) {
        this.skuOptionId = aValue;
    }

    /**
     * * @return Integer
     *
     * @hibernate.property column="sortOrder" type="java.lang.Integer" length="10" not-null="true" unique="false"
     */
    public Integer getSortOrder() {
        return this.sortOrder;
    }

    /**
     * Set the sortOrder
     *
     * @spring.validator type="required"
     */
    public void setSortOrder(Integer aValue) {
        this.sortOrder = aValue;
    }

    /**
     * @see java.lang.Object#equals(Object)
     */
    public boolean equals(Object object) {
        if (!(object instanceof SkuOptionSearchTbl)) {
            return false;
        }
        SkuOptionSearchTbl rhs = (SkuOptionSearchTbl) object;
        return new EqualsBuilder()
                .append(this.skuOptionSearchId, rhs.skuOptionSearchId)
                .append(this.skuOptionId, rhs.skuOptionId)
                .append(this.sortOrder, rhs.sortOrder)
                .isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder(-82280557, -700257973)
                .append(this.skuOptionSearchId)
                .append(this.skuOptionId)
                .append(this.sortOrder)
                .toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this)
                .append("skuOptionSearchId", this.skuOptionSearchId)
                .append("skuOptionId", this.skuOptionId)
                .append("sortOrder", this.sortOrder)
                .toString();
    }

    /**
     * Return the name of the first key column
     */
    public String getFirstKeyColumnName() {
        return "skuOptionSearchId";
    }

    /**
     * Return the Id (pk) of the entity, must be Integer
     */
	public Integer getId() {
		return skuOptionSearchId;
	}

}